package ext.acae2.dms.validator;

import org.apache.log4j.Logger;

import ext.acae2.utilities.principal.CSCPrincipal;

import wt.doc.WTDocument;
import wt.log4j.LogR;
import wt.org.WTGroup;
import wt.org.WTUser;
import wt.util.WTException;

/**
 * @desription data import way check
 * @author cnie
 * @date 2013-3-21 下午1:08:54
 */
public class DataImportWayFilter {
	
	private static final Logger logger = LogR.getLogger(DataImportWayFilter.class.getName());
	
	
	/**
	 * 
	 * @description data import way check
	 * @author cnie
	 * @date 2013-3-21 下午1:11:09
	 * @version 1.0
	 * @return
	 * @throws WTException 
	 */
	public static String checkDataImportWay(Object pbo) throws WTException{
		String way="user";
		if(pbo instanceof WTDocument){
			WTDocument doc = (WTDocument)pbo;
			WTUser createUser = (WTUser) doc.getCreator().getPrincipal();
			WTGroup adminGroup = CSCPrincipal.getGroupByName("Administrators");
			if(adminGroup.isMember(createUser)){
				way= "Administrator";
			}else{
				way= "user";
			}
		}
		return way;
		
	}
	
	/**
	 * @description check import designer
	 * @author cnie
	 * @date 2013-3-22 上午9:53:42
	 * @version 1.0
	 */
	private static void checkImportDesignerExit() {

	}

}
